home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic 4 Database How-To
/
Visual Basic 4 Database - How-to (The Waite Group)(1995).iso
/
undobnd.fr_
/
undobnd.fr
Wrap
Text File
|
1995-07-04
|
5KB
|
179 lines
VERSION 4.00
Begin VB.Form Form1
BackColor = &H00C0C0C0&
Caption = "Undo Browser"
ClientHeight = 2745
ClientLeft = 1155
ClientTop = 2295
ClientWidth = 6420
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 8.25
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 3435
Left = 1095
LinkTopic = "Form1"
ScaleHeight = 2745
ScaleWidth = 6420
Top = 1665
Width = 6540
Begin VB.TextBox txtISBN
DataField = "ISBN"
DataSource = "dtaTitles"
Height = 315
Left = 1860
MaxLength = 13
TabIndex = 2
Top = 1380
Width = 1635
End
Begin VB.TextBox txtYearPublished
DataField = "Year Published"
DataSource = "dtaTitles"
Height = 285
Left = 1860
TabIndex = 1
Top = 900
Width = 735
End
Begin VB.TextBox txtTitle
DataField = "Title"
DataSource = "dtaTitles"
Height = 555
Left = 1860
MultiLine = -1 'True
TabIndex = 0
Top = 180
Width = 4095
End
Begin VB.Data dtaTitles
Caption = "Titles"
Connect = "Access"
DatabaseName = "C:\VB\BIBLIO.MDB"
Exclusive = 0 'False
Height = 300
Left = 660
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "Titles"
Top = 2040
Width = 1815
End
Begin VB.Label Label3
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "ISBN:"
Height = 195
Left = 1200
TabIndex = 5
Top = 1440
Width = 510
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "Year Published:"
Height = 195
Left = 360
TabIndex = 4
Top = 960
Width = 1350
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "Title:"
Height = 195
Left = 1200
TabIndex = 3
Top = 180
Width = 450
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileExit
Caption = "E&xit"
End
End
Begin VB.Menu mnuEdit
Caption = "&Edit"
Begin VB.Menu mnuEditUndo
Caption = "&Undo"
Shortcut = %{BKSP}
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Private UpdateCancelled As Boolean
Private Sub dtaTitles_Validate(Action As Integer, Save As Integer)
Dim msg As String
If Save = True Then
' One or more bound controls has changed, so verify that all fields
' have legal entries. If a field has an incorrect value, set the
' variable msg to a string explaining the error and set the focus
' to that field to facilitate the user's correcting the error.
If txtTitle = "" Then
msg = "You must enter a title."
txtTitle.SetFocus
ElseIf txtISBN = "" Then
msg = "You must enter an ISBN."
txtISBN.SetFocus
ElseIf txtYearPublished <> "" And Not IsNumeric(txtYearPublished) Then
msg = "The Year Published must be numeric."
txtYearPublished.SetFocus
End If
End If
If msg <> "" Then
' We have something in the variable msg, which means that an error
' has occurred. Display the message for the user.
MsgBox msg, vbExclamation
' Cancel the Validate event
Action = vbDataActionCancel
' Set the form-level variable UpdateCancelled to True. This flags
' the Unload event to cancel the unload.
UpdateCancelled = True
Else
' No errors, so set the form level variable UpdateCancelled False
' to flag the Unload event to go ahead and proceed with the unload.
UpdateCancelled = False
End If
End Sub
Private Sub mnuEditUndo_Click()
' The user wants to undo all changes to the current record, so restore
' the values in the controls to the recordset values.
dtaTitles.UpdateControls
End Sub
Private Sub mnuFileExit_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
' If the Validate event set the UpdateCancelled flag, cancel the unload.
If UpdateCancelled Then Cancel = True
End Sub